package com.jine.boot2.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.UUID;

@Entity
@Data
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler"})     //在调用查询一条记录时会报错
public class User {

    @Id
    @Column(name = "id", length = 32, unique = true, nullable = false)
    @GeneratedValue(generator = "userIdGenerator")
    @GenericGenerator(name = "userIdGenerator", strategy = "uuid")
    private String id;
    private String username;
    private String password;
    private String mail;
    @Column(name = "phone", length = 11)
    private String phone;
    @Column(name = "state", length = 1)
    private String state;
    @Column(name = "type", length = 1)
    private String type;

    public User(){}

    public User(String username,String password){
//        this.id = UUID.randomUUID().toString();
        this.username=username;
        this.password=password;
        this.state="1";
        this.type="1";
    }

}
